<!-- 主题设置模板 -->

<style>
  .radio-container {
    display: flex;
    justify-content: left;
    /* 如果你想要居中对齐 */
  }
</style>
<script type="text/html" template lay-done="layui.data.sendParams(d.params);">

</script>

<div id="appId">
  <div class="radio-container" @change="goAd">

    <vs-radio success v-for="(year, index) in years" :key="index" v-model="picked" :val="index + 1"
      style="margin: 6px 10px 0 0;">
      第{{chineseNum[index + 1]}}年
    </vs-radio>

  </div>

</div>



<script>
  layui.data.sendParams = function (params) {

    let { viewId, startNum, endNum, ...param } = params;
    viewId = viewId || 'appId';
    startNum = startNum || 1;
    endNum = endNum || 7;
    viewId = 'appId';
    //若需用到 layui 组件，layui.use 需写在该全局方法里面，如：
    layui.use(['admin', 'view'], function () {

      var admin = layui.admin;
      var gameId = layui.router().search.id;
      var view = layui.view;

      var myApp = new Vue({
        el: '#' + viewId,
        data: function () {
          return {
            gameId: gameId, // 假设这是从某处获取的游戏ID  
            years: Array.from({ length: endNum - startNum + 1 }, (_, i) => i + startNum),
            chineseNum: ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"],

            // 初始化picked为1，表示默认选中第一年  
            picked: 1,
          }
        }
        , methods: {
          goAd(data) {
            console.log(myApp.picked);
            // return 'Team/edit/id=' + id;
          },
          handleRadioChange() {
            console.log('Radio button clicked with value:', this.selected);
          },
          getData() {

          },
          reload() {
            myApp.count = 100;
          },
          loadForm(value) {
            myApp.count = value;
          },
          showForm() {
            admin.popup({
              title: '添加分类'
              , area: ['450px', '200px']
              , id: 'LAY-popup-content-tags'
              , success: function (layero, index) {
                view(this.id).render('test/vueFrom', { closeIndex: index, loadForm: myApp.loadForm })
              }
            });
          },
        },
        mounted: function () {
          // this.getData();


        },
        created: function () {
          //	this.getData();
        },


      });

    });
  }
</script>